using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Mail;
using Decav.Reality;
using Decav.Gatsb.Mobile;

namespace Decav.Gatsb.MobileProviders
{
    /// <summary>
    /// Provides services for the Verizon Wireless telephone service.
    /// </summary>
    [Serializable]
    public class VerizonServiceProvider : TelephoneServiceProvider
    {
        public VerizonServiceProvider()
            : base("Verizon Wireless")
        {
        }

        /// <summary>
        /// Gets whether or not the specified address is an SMS or MMS address issued by this service provider.
        /// </summary>
        /// <param name="mailAddress">The address to parse.</param>
        /// <returns>True when the address is for this provider, else false.</returns>
        public override bool IsProviderMailAddress(string mailAddress)
        {
            if (mailAddress == null)
                throw new ArgumentNullException("mailAddress");

            mailAddress = mailAddress.ToLower();
            return mailAddress.Contains("@vtext.com") || mailAddress.Contains("@vzwpix.com");
        }

        public override IPhoneMessageParser CreateMessageParser()
        {
            return new VerizonMessageParser();
        }

        public override EmailAddress CreateSmsAddress(PhoneNumber phoneNumber)
        {
            return new EmailAddress(string.Format("{0}@vtext.com", phoneNumber));
        }

        public override EmailAddress CreateMmsAddress(PhoneNumber phoneNumber)
        {
            return new EmailAddress(string.Format("{0}@vzwpix.com", phoneNumber));
        }
    }
}
